home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Modules / BackSpaceModules / Source / SparseLifeView / SparseLifeView.h < prev    next >
Text File  |  1993-11-04  |  3KB  |  104 lines

  1. #import <appkit/View.h>
  2.  
  3. #define ITERATIONS 20000/* max # of iterations before restarting */
  4. #define PANELTIME 333   /* ms delay between *panel* animation frames */
  5. /* #define LIVEEDGE        if defined, edge annhilates drifters */
  6. #define DEEPEDGE 3      /* edge is this # squares beyond visible */
  7. #define MINCELLSIZE 2   /* Make sure cell size gets no smaller than... */
  8. #define MAXCELLSIZE 24  /* Make sure cell size gets no bigger than... */
  9. #define COLORS 24       /* Generations from youngest color to oldest color */
  10. #define SQUAREBLOCK 64  /* Number of squares of one color to draw at once */
  11. #define STATSIZE 1024   /* Recognizes all stasis periods up to this number */
  12. #define STATIVAL 64     /* Takes up to this long to recognize stasis */
  13. #ifdef DEEPEDGE
  14. #  define MAXCOLS (1280/MINCELLSIZE+2+2*DEEPEDGE)
  15. #  define MAXROWS (1024/MINCELLSIZE+2+2*DEEPEDGE)
  16. #else
  17. #  define MAXCOLS (1280/MINCELLSIZE+2) /* full screen of smallest cells (x) */
  18. #  define MAXROWS (1024/MINCELLSIZE+2) /* (y) */
  19. #endif
  20.  
  21. typedef struct _lifecell {
  22.     int next;
  23.     char neighbors;
  24.     char color;
  25. } lifecell;
  26.  
  27. @interface SparseLifeView:View
  28. {
  29.     lifecell Grid[MAXCOLS*MAXROWS];
  30.  
  31.     int ifirst;
  32.     int ncols, nrows;
  33.     int countDown;
  34.     int installedCountDown;
  35.     int cellSize;
  36.     int xoffset, yoffset;
  37.  
  38.     NXColor youngColor;
  39.     NXColor mediumColor;
  40.     NXColor oldColor;
  41.  
  42.     NXColor colorTable[COLORS];
  43.     int squareCount[COLORS];
  44.     NXRect squareBuffer[COLORS][SQUAREBLOCK];
  45.     
  46.     int stasis[STATSIZE];
  47.     int strack;
  48.     int spass;
  49.     int sindex;
  50.  
  51.     id sharedInspectorPanel;
  52.     id panelYoungColorWell;
  53.     id panelMediumColorWell;
  54.     id panelOldColorWell;
  55.     id panelRestartButton;
  56.     id panelStepButton;
  57.     id panelLifeView;
  58.     id panelCreditsView;
  59.     id panelSizeMatrix;
  60. }
  61.  
  62. - oneStep;
  63. - drawSquares;
  64. - putSquare:(int)x :(int)y Color:(int)color;
  65. - flushColor:(int)color;
  66. - flushSquares;
  67. - drawSelf:(const NXRect *)rects :(int)rectCount;
  68. - (const char *) windowTitle;
  69. - setupSquareBuffer;
  70. - initFrame:(const NXRect *)frameRect;
  71. - getLifeDefaults;
  72. - sizeTo:(NXCoord)width :(NXCoord)height;
  73. - initLife;
  74. - checkStasis:(int)checksum;
  75.  
  76. - computeColors;
  77. - updateViews;
  78.  
  79. - inspector:sender;
  80. - inspectorInstalled;
  81. - takeYoungColorFrom:sender;
  82. - takeMediumColorFrom:sender;
  83. - takeOldColorFrom:sender;
  84. - doSizeMatrix:sender;
  85. - doSingleStep:sender;
  86. - doRestart:sender;
  87.  
  88. - showCredits:sender;
  89. - hideCredits:sender;
  90.  
  91. - doShowCredits:sender;
  92. - doHideCredits:sender;
  93.  
  94. @end
  95.  
  96. @interface StaticSparseLifeView:SparseLifeView
  97. {
  98. }
  99. - setYoungColor:(NXColor)yc MediumColor:(NXColor)mc OldColor:(NXColor)oc;
  100. - setLifeCellSize:(int)cs;
  101.  
  102. @end
  103.  
  104.